/**
	Copyright (c) 2009 ATTi 
	All rights reserved.
	Author: Michael Shu
	Date: 12/28/2009
*/
@isTest
private class SelectTemplateEmailControllerTester {
	private static SelectTemplateEmailController controller;
		
	public static testmethod void testSelectTemplateEmail(){
		List<Folder> folders = new List<Folder>([Select f.Id, f.Name, f.Type from Folder f where f.Type = 'Email']);	
		PageReference pageRef = Page.SelectTemplateEmailPage;
		Test.setCurrentPage(pageRef);	
		controller = new SelectTemplateEmailController();	
		
		List<EmailTemplate> templates= new List<EmailTemplate>([select e.Name, e.Id, e.TemplateType, e.Description from EmailTemplate e 
		                                         where e.FolderId =: folders[0].Id and e.IsActive =: true Order By e.Name]);
		controller.selectedFolderId = folders[0].Id;
		controller.refresh();
		if(templates == null){
			System.assertEquals(null, controller.leTemplate);
		}else{
			for(Integer i= 0 ; i < templates.size(); i++){
				System.assertEquals(templates[i].Name , controller.leTemplate[i].Name);
			}
		}
	}
}